import { _decorator, Component, Node, find, Label } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('ExpUpdate')
export class ExpUpdate extends Component {

    @property(Node) labelValue: Node
    @property(Node) bar: Node
    player: Node

    start() {
        this.player = find("Map/player")
    }

    update(deltaTime: number) {
        const scale: number = this.player.getScale().x
        const val: number = Math.floor(scale)
        const scaleX: number = scale - val
        this.labelValue.getComponent(Label).string = String(val)
        this.bar.setScale(scaleX, 1, 1)
        
    }
}


